
import 'package:flutter/material.dart';

class PageViewDemo extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return PageView(
      onPageChanged: (currentPage)=>{
        debugPrint('Page: $currentPage')
      },
      controller: new PageController(
          initialPage: 1,
          keepPage: false,
          viewportFraction: 0.8
      ),
      scrollDirection:  Axis.horizontal,
      children: [
        Container(
          color: Colors.orangeAccent,
          child:  Center(
            child: Text("one"),
          ),
        ),
        Container(
          alignment: Alignment.center,
          color: Colors.red,
          child: Text("two"),
        )
      ],
    );
  }

}